package shuishijie.suishijie.model;

import android.text.TextUtils;

import java.util.List;

/**
 * Created by mindx on 2017/8/29.
 */

public class OrderInfo {

    /**
     * address : 河北省,邯郸市,峰峰矿区发发发
     * child : [{"goodsCount":1,"goodsName":"世界村生命源水510ml24瓶箱富硒山泉水天然弱碱性剐水泡茶饮用","goodsPrice":20,"imgPath":"http://fcp.oss-cn-beijing.aliyuncs.com/goods/4500shuibanner1.jpg","specInfo":"510ml/24瓶"},{"goodsCount":3,"goodsName":"世界村生命源水4.5L*4桶/箱 天然富硒泉水天然弱碱性剐水泡茶饮用","goodsPrice":118,"imgPath":"http://fcp.oss-cn-beijing.aliyuncs.com/goods/4500shui1.jpg","specInfo":"4.5L/4桶"}]
     * couponCount : 0
     * phone : 13122224456
     * shoppingcoinCount : 0
     * totalCount : 4
     * totalPrice : 374`
     * transportPrice : 0
     * userName : www
     */

    public String address = "'";
    public int couponCount;
    public int addr_id;
    public int coin;
    public String phone = "";
    public int shoppingcoinCount;
    public int totalCount;
    public double totalPrice;
    public double couponPrice;
    public double transportPrice;
    public String userName = "";
    public List<OrderGoods> child;

    public double getPriceToPay() {
        return transportPrice + totalPrice - couponPrice;
    }

    public static class OrderGoods {
        /**
         * goodsCount : 1
         * goodsName : 世界村生命源水510ml24瓶箱富硒山泉水天然弱碱性剐水泡茶饮用
         * goodsPrice : 20
         * imgPath : http://fcp.oss-cn-beijing.aliyuncs.com/goods/4500shuibanner1.jpg
         * specInfo : 510ml/24瓶
         */

        private int goodsCount;
        private int count;

        public int getGoodsCount() {
            return goodsCount > 0 ? goodsCount : count;
        }

        public void setGoodsCount(int goodsCount) {
            this.goodsCount = goodsCount;
        }

        public String tag;
        public String goodsName;
        private double goodsPrice;
        private String imgPath;
        public String specInfo;

        /**
         * goodsCount : 1
         * goodsName : 泰国进口新鲜山竹热带应季时令水果5斤装广东省内顺丰免邮
         * goods_id : 1074
         * path : http://fcp.oss-cn-beijing.aliyuncs.com/goods/69ae66ef-2e81-4b25-8bf3-ab672379adf6.png
         * specInfo : 16KG/箱
         * totalPrice : 27.0
         */

        public String goods_id;
        private String path;
        private String totalPrice;

        public void setGoodsPrice(double goodsPrice) {
            this.goodsPrice = goodsPrice;
        }

        public void setImgPath(String imgPath) {
            this.imgPath = imgPath;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public void setTotalPrice(String totalPrice) {
            this.totalPrice = totalPrice;
        }

        public String getPath() {
            return TextUtils.isEmpty(path) ? imgPath : path;
        }

        public double getPrice() {
            return goodsPrice > 0 ? goodsPrice : Double.parseDouble(totalPrice);
        }
    }

    /**
     * 订单生生成
     */
    public List<String> carIds;
    public String order_id;
    public int id;


}
